function cancel_offer(id, status)
{
	switch(status)
	{
		case "Available":
			var $dialog = $('<div></div>')
				.html('There may be people interested in your item. Are you sure you want to remove this offer?')
				.dialog({
					modal: 'true',
					title : 'Remove Offer',
					buttons : 
					{
						'Yes' : function()
								{
									$.ajax({
										url : "home/remove_offer/",
										type : 'post',
										data :
										{
											status : 'available',
											offer_id : id,
										},
										success : function(response) {
											removeOffer(id);
										}
									});
									$(this).dialog('close');
								},
						'No' : function()
								{
									$(this).dialog('close');
								}
					}
				});
			break;
		case "Reserved":
			var $dialog = $('<div></div>')
				.html('You have already reserved your item to someone. Are you sure you want to reject your reservation?')
				.dialog({
					modal: 'true',
					title : 'Cancel Offer',
					buttons : 
					{
						'Yes' : function()
								{
									$.ajax({
										url : "home/remove_offer/",
										type : 'post',
										data :
										{
											status : 'reserved',
											offer_id : id,
										},
										success : function(response) {
											$("#offer_"+id+"_status").text("Status : Available");
										}
									});
									$(this).dialog('close');
								},
						'No' : function()
								{
									$(this).dialog('close');
								}
					}
				});
			break;
		default:
			
	}
}

function cancel_request(id, status)
{
	switch(status)
	{
		case "Pending":
			var $dialog = $('<div></div>')
				.html('Are you sure you want to remove this request?')
				.dialog({
					modal: 'true',
					title : 'Remove Request',
					buttons : 
					{
						'Yes' : function()
								{
									$.ajax({
										url : "home/remove_request/",
										type : 'post',
										data :
										{
											status : 'pending',
											offer_id : id,
										},
										success : function(response) {
											removeRequest(id);
										}
									});
									$(this).dialog('close');
								},
						'No' : function()
								{
									$(this).dialog('close');
								}
					}
				});
			break;
		case "Offered to you":
			var $dialog = $('<div></div>')
				.html("This item has been offered to you. Are you sure you don't want it anymore?")
				.dialog({
					modal: 'true',
					title : 'Cancel Request',
					buttons : 
					{
						'Yes' : function()
								{
									$.ajax({
										url : "home/remove_request/",
										type : 'post',
										data :
										{
											status : 'offeredtoyou',
											offer_id : id,
										},
										success : function(response) {
											removeRequest(id);
										}
									});
									$(this).dialog('close');
								},
						'No' : function()
								{
									$(this).dialog('close');
								}
					}
				});
			break;
		case "Offered to someone else":
			var $dialog = $('<div></div>')
				.html("You may still get this item if the offer does not go through. Are you sure you don't want it anymore?")
				.dialog({
					modal: 'true',
					title : 'Remove Request',
					buttons : 
					{
						'Yes' : function()
								{
									$.ajax({
										url : "home/remove_request/",
										type : 'post',
										data :
										{
											status : 'offeredtosomeoneelse',
											offer_id : id,
										},
										success : function(response) {
											removeRequest(id);
										}
									});
									$(this).dialog('close');
								},
						'No' : function()
								{
									$(this).dialog('close');
								}
					}
				});
			break;
		default:
			
	}

}